#include "wt588f_api.h"
#include "wt588f_board.h"

#if _VOICE_PLAY_TYPE_ == _VOICE_PLAY_SPEAKER_

bool Wt588fBuildSetVolumeLevelMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t Level)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    if (Level <= WT588F_MAX_VOLUME_LEVEL)
    {
      uint8_t VoiceDataSize = 0;

      pDataOut[VoiceDataSize++] = WT588F_VOLUME_LEVEL + Level;

      *pSizeOut = VoiceDataSize;
      return true;
    }
  }

  return false;
}

bool Wt588fBuildStartupToneMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_TONE_STATUP;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildKeyMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_TONE_KEY;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildAlarmMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_ALARM;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildDoorbellMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    for (uint8_t i = 0; i < 2; i++)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_TONE_DOORBELL;
      pDataOut[VoiceDataSize++] = WT588F_INSERT_MUTE;
      pDataOut[VoiceDataSize++] = 0xC8;
    }

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildSwitchFaceAuthenticationModeMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_SWITCH;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_FACE;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_MODE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildSwitchQrcodeAuthenticationModeMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_SWITCH;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_QRCODE;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_MODE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildSettingStatusMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool Status)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_SETTING;
    pDataOut[VoiceDataSize++] = WT588F_INSERT_MUTE;
    pDataOut[VoiceDataSize++] = (Status == true) ? VOICE_SUCCEED : VOICE_FAIL;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildVerificationStateMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool Status)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_VERIFICATION;
    pDataOut[VoiceDataSize++] = WT588F_INSERT_MUTE;
    pDataOut[VoiceDataSize++] = (Status == true) ? VOICE_SUCCEED : VOICE_FAIL;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildDeviceDiscoverStatusMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool Status)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = (Status == true) ? VOICE_TURN_ON : VOICE_TURN_OFF;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_DEVICE_DISCOVER;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildFactoryResetStatusMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool Status)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_FACTORY_RESET;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = (Status == true) ? VOICE_SUCCEED : VOICE_FAIL;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildUserRegistrationStatusMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool Status)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_REGISTER;
    if (Status == true)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_SUCCEED;
    }
    else
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_FAIL;
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_PLEASE_TRY_AGAIN;
    }

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildExitLocalRegisterMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_REGISTER;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_MODE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildExitVerificationModeMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_VERIFICATION;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_MODE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildPermissionDeniedMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_INSUFFICIENT_PRIVILEGES;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_TRY_AGAIN;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildEquipmentBusyStatusMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EQUIIPMENT_BUSY;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_WAIT;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildCurrentLockStatusMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool LockStatus)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = (LockStatus == false) ? VOICE_LOCK_CLOSED : VOICE_LOCK_UNLOCKED;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildNetworkQualityMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t Rssi)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_RSSI_VALUE;
    if (Rssi / 10)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_TEN + ((Rssi / 10) - 1);
    }

    if ((Rssi % 10) || (Rssi < 10))
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = Rssi % 10;
    }

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildConfigurationNormallyOpenModeMessage(uint8_t *pDataOut, uint8_t *pSizeOut, bool Mode)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = (Mode == true) ? VOICE_TURN_ON : VOICE_TURN_OFF;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_NORMALLY_OPEN_MODE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildNotifyTheDeviceThatTheFileIsBeingDeliveredMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_FILE_RECEIVING;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_WAIT;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildSystemLockMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ALARM;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_SYSTEM_LOCKED;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLowBatteryMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_BATTERY_LOW;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildAddNewCardMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_SWIPE_CARD;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildEnterKeyViaTheKeyboardMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_PASSWORD;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_KEYVALUE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildInvalidKeyValueMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_INVALID_INPUTS;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_TRY_AGAIN;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildPasswordComparisonIsInconsistentMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_INCONSISTENT_COMPARISON;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_PASSWORD;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildVerifyThatTheEnteredValuesAreConsistentMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_IT_AGAIN;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_KEYVALUE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildStartRegisterFaceEigenvaluesMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t Second)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENABLE_FACE_ENTRY_1;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = Second;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENABLE_FACE_ENTRY_2;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLookMiddleMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_LOOK_MIDDLE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLookUpMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_LOOK_UP;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLookDownMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_LOOK_DOWN;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLookLeftMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_LOOK_LEFT;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLookRightMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_LOOK_RIGHT;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildStartPrintingMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_PRESS_YOUR_FINGER;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildReadmissionPrintingMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_DUPLICATE_FINGERPRINT_ENTRY;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildPleaseScanQrCodeMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_SCANF_QRCODE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildIndicatesDeviceInTheInitializationStateMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;
    pDataOut[VoiceDataSize++] = VOICE_ADD_ADMINISTRATOR;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildExpirationReminderMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t Days)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_KEYWORD_RENEW_LEASE_0;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = Days;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_KEYWORD_RENEW_LEASE_1;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildDeviceAuthorizationSuccessfulMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if (pDataOut != NULL && pSizeOut != NULL)
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_SUCCEED;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildConnectTestMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if (pDataOut != NULL && pSizeOut != NULL)
  {
    uint8_t VoiceDataSize = 0;
    pDataOut[VoiceDataSize++] = VOICE_TONE_DOORBELL;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildSelfTestErrorMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t ErrorCode)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_FAIL;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ABNORMAL;
    if (ErrorCode / 10)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = ErrorCode / 10;
    }

    if ((ErrorCode % 10) || (ErrorCode < 10))
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = ErrorCode % 10;
    }

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildLicenseExpiredMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_KEYWORD_RENEW_LEASE_0;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildUserAlreadyExistsMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_USER;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXISTING;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildVerifyAdminPasswordMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

#if _BOARD_TYPE_ == _V33_A_BOARD_
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_PASSWORD;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;
#else
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_VERIFY;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ADMINISTRATOR;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PASSWORD;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_ENTER_KEYVALUE;
#endif

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildExitRegisterMethodMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildPleaseVerifyUserPermissionsMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PLEASE_VERIFY;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_USER;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PERMISSION;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXIT_KEYVALUE;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildDeviceLockedMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = VOICE_LOCKED;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildCardReplacedMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_CARD;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_REPLACED;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildCardExpiredMessage(uint8_t *pDataOut, uint8_t *pSizeOut)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_CARD;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_EXPIRED;

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildRegisterUserCountMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t SuccessCount, uint8_t FailureCount)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_REGISTER;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_SUCCEED;

    if (SuccessCount / 10)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_TEN + ((SuccessCount / 10) - 1);
    }

    if ((SuccessCount % 10) || (SuccessCount < 10))
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = SuccessCount % 10;
    }

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_FAIL;

    if (FailureCount / 10)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_TEN + ((FailureCount / 10) - 1);
    }

    if ((FailureCount % 10) || (FailureCount < 10))
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = FailureCount % 10;
    }

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

bool Wt588fBuildRemainingBatteryPercentageMessage(uint8_t *pDataOut, uint8_t *pSizeOut, uint8_t BatteryPercentage)
{
  if ((pDataOut != NULL) && (pSizeOut != NULL))
  {
    uint8_t VoiceDataSize = 0;

    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_REMAINING;
    pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
    pDataOut[VoiceDataSize++] = VOICE_PERCENTAGE;

    if (BatteryPercentage / 10)
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = VOICE_TEN + ((BatteryPercentage / 10) - 1);
    }

    if ((BatteryPercentage % 10) || (BatteryPercentage < 10))
    {
      pDataOut[VoiceDataSize++] = WT588F_LINK_PLAY;
      pDataOut[VoiceDataSize++] = BatteryPercentage % 10;
    }

    *pSizeOut = VoiceDataSize;
    return true;
  }

  return false;
}

#endif
